package com.daigoudao.web.service.impl;

import java.util.List;

import com.daigoudao.web.dao.ISimpleBuyDao;
import com.daigoudao.web.model.SimpleBuyModel;
import com.daigoudao.web.service.ISimpleBuyService;

public class SimpleBuyServiceImpl implements ISimpleBuyService {

	private ISimpleBuyDao simpleBuyDao;

	@Override
	public void addSimpleBuy(SimpleBuyModel simpleBuyModel) throws Exception {
		simpleBuyDao.addSimpleBuy(simpleBuyModel);
	}

	/**
	 * 根据id查询搭车求购信息
	 * 
	 * @param simpleId
	 * @return
	 * @throws Exception
	 */
	public SimpleBuyModel querySimpleBuy(int simpleId) throws Exception {
		return simpleBuyDao.querySimpleBuy(simpleId);
	}

	public void setSimpleBuyDao(ISimpleBuyDao simpleBuyDao) {
		this.simpleBuyDao = simpleBuyDao;
	}

	public List<SimpleBuyModel> querySimpleBuyModels(
			SimpleBuyModel simpleBuyModel) throws Exception {
		return simpleBuyDao.querySimpleBuys(simpleBuyModel);
	}

	public boolean isRideBuy(SimpleBuyModel simpleBuyModel) throws Exception {
		return simpleBuyDao.getSimpleBuyCount(simpleBuyModel) > 0;
	}
}
